home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 103 / XENIATGM103.iso / Shareware / GoLive 5.0 / MM7.Cab / F1438_DragFloatingBox.action.F6A680DD_F3FB_4CF3_BABB_0D0F06E630F5 < prev    next >
Text File  |  2000-08-17  |  5KB  |  142 lines

  1. <html>
  2.  
  3.     <head>
  4.         <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
  5.         <title>Drag Floating Box Action</title>
  6.         <meta name="generator" content="Adobe GoLive 5">
  7.     </head>
  8.  
  9.     <body bgcolor="white">
  10.         <center>
  11.             <font size="6">Drag Floating Box Action</font>
  12.             <hr>
  13.         </center>
  14.         <csactionclass name="Drag Floating Box" function="CSDrag" nsversion="4" ieversion="4">
  15.         <csactionparam name="layer" type="GLActionLayerParam"></csactionparam>
  16.         </csactionclass>
  17.         <p>IE Functions Script
  18.         <script language="JavaScript1.2" src="../../GlobalScripts/IE.scpt" cyberversion="N1.2"></script>
  19.         </p>
  20.         <p>Drag Action Main Script
  21.         <script language="JavaScript1.2" cyberversion="N1.2"><!--
  22. var gCSIEDragObject = null;
  23. function CSSetupDrag (layerName) {
  24.     this.x = 0; this.y = 0;
  25.     if (IsIE()) {
  26.         this.canDrag=true; 
  27.         this.layerObj=document.all.tags("div")[layerName];
  28.         this.layerObj.dragObj = this;
  29.         document.ondragstart = CSIEStartDrag;
  30.         document.onmousedown = CSIEMouseDown;
  31.         document.onmouseup = CSIEStopDrag;
  32.     } else {
  33.         this.layer=CSNSStyl(layerName);this.onmousemove=null; 
  34.         this.layer.document.theLayer=this;
  35.         this.layer.document.captureEvents(Event.MOUSEDOWN);
  36.         this.layer.document.onmousedown=CSNSStartDrag; 
  37.         this.layer.document.onmouseup=CSNSStopDrag;
  38.     }
  39. }
  40. function CSNSStartDrag (ev) {
  41.     var clickInMe = false;
  42.     if (ev.target != this) {
  43.         for (var i=0;i<this.images.length;i++) {
  44.             if (this.images[i] == ev.target) { clickInMe = true; break;}
  45.             }
  46.         }
  47.     else clickInMe = true;    
  48.     if (clickInMe)
  49.         {
  50.         this.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); 
  51.         this.onmousemove=CSNSDoDrag;
  52.         this.theLayer.x= ev.pageX;
  53.         this.theLayer.y= ev.pageY;
  54.         this.routeEvent(ev);
  55.         return false;
  56.         }
  57.    this.onmousemove=null;this.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
  58.     this.routeEvent(ev);
  59.    return true; 
  60. }
  61. function CSNSStopDrag (ev) {
  62.    this.onmousemove=null;this.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);return false; 
  63. }
  64. function CSNSDoDrag (ev) {
  65.     this.theLayer.layer.moveBy(ev.pageX-this.theLayer.x, ev.pageY-this.theLayer.y); 
  66.     this.theLayer.x = ev.pageX; 
  67.     this.theLayer.y = ev.pageY;
  68.     this.routeEvent(ev);
  69. }
  70. function CSIEStartDrag () {
  71.     if(gCSIEDragObject != null && (gCSIEDragObject.tagName==event.srcElement.tagName))
  72.         event.returnValue=false;  
  73. }
  74. function CSIEStopDrag () { gCSIEDragObject=null; document.onmousemove=null; }
  75. function CSIEMouseDown () {
  76.     if(event.button==1) {
  77.         dragLayer = event.srcElement;
  78.         while (dragLayer!=null) 
  79.             {
  80.             if ((dragLayer.dragObj == null) && (dragLayer.tagName == "DIV"))
  81.                 break;
  82.             if (dragLayer.dragObj != null)
  83.                 break;
  84.             dragLayer=dragLayer.parentElement;
  85.             }
  86.             
  87.         if (dragLayer == null) return;
  88.         if (dragLayer.dragObj!=null && dragLayer.dragObj.canDrag) {
  89.             gCSIEDragObject = dragLayer;
  90.             gCSIEDragObject.dragObj.x=event.clientX;
  91.             gCSIEDragObject.dragObj.y=event.clientY;
  92.             document.onmousemove = CSIEMouseMove;
  93.         }
  94.     }
  95. }
  96. function CSIEMouseMove () {
  97.     gCSIEDragObject.dragObj.layerObj.style.pixelLeft+=(event.clientX-gCSIEDragObject.dragObj.x);
  98.     gCSIEDragObject.dragObj.layerObj.style.pixelTop+=(event.clientY-gCSIEDragObject.dragObj.y);
  99.     gCSIEDragObject.dragObj.x=event.clientX;
  100.     gCSIEDragObject.dragObj.y=event.clientY;
  101.     event.returnValue = false;
  102.     event.cancelBubble = true;
  103. }
  104. var gDragArray = new Array();
  105. function CSDrag(action) { gDragArray[gDragArray.length] = new CSSetupDrag(action[1]); }
  106. // -->
  107.         </script>
  108.         </p>
  109.  
  110.         <table cool width="221" height="153" border="0" cellpadding="0" cellspacing="0" gridx="16" showgridx gridy="16" showgridy bgcolor="#eeeeee">
  111.             <tr height="1" cntrlrow>
  112.                 <td width="1" height="1"><spacer type="block" width="1" height="1"></td>
  113.                 <td width="4" height="1"><spacer type="block" width="4" height="1"></td>
  114.                 <td width="76" height="1"><spacer type="block" width="76" height="1"></td>
  115.                 <td width="140" height="1"><spacer type="block" width="140" height="1"></td>
  116.             </tr>
  117.             <tr height="6">
  118.                 <td width="1" height="6"><spacer type="block" width="1" height="6"></td>
  119.                 <td width="4" height="6"><spacer type="block" width="4" height="6"></td>
  120.                 <td width="76" height="6"><spacer type="block" width="76" height="6"></td>
  121.                 <td width="140" height="6"><spacer type="block" width="140" height="6"></td>
  122.             </tr>
  123.             <tr height="3">
  124.                 <td width="1" height="3"><spacer type="block" width="1" height="3"></td>
  125.                 <td width="4" height="3"><spacer type="block" width="4" height="3"></td>
  126.                 <td width="76" height="3"><spacer type="block" width="76" height="3"></td>
  127.                 <td width="140" height="146" colspan="1" rowspan="2" valign="top" align="left" xpos="80">
  128.                     <csactioncntrl name="layer" x="80" y="6" width="136" height="18" alignx="scale" aligny="top">
  129.                 </td>
  130.             </tr>
  131.             <tr height="143">
  132.                 <td width="1" height="143"><spacer type="block" width="1" height="143"></td>
  133.                 <td width="4" height="143"><spacer type="block" width="4" height="143"></td>
  134.                 <td width="76" height="143" colspan="1" rowspan="1" valign="top" align="left" xpos="4">
  135.                     <csactioncntrl type="InfoText" value="Floating Box" x="4" y="9" width="75" height="16" alignx="left" aligny="top">
  136.                 </td>
  137.             </tr>
  138.         </table>
  139.     </body>
  140.  
  141. </html>
  142.